package com.dingreading.cloud.admin.service.impl;

import com.dingreading.cloud.admin.entity.SubjectLessonIssueImg;
import com.dingreading.cloud.admin.entity.table.SubjectLessonIssueImgTableDef;
import com.dingreading.cloud.admin.mapper.SubjectLessonIssueImgMapper;
import com.dingreading.cloud.admin.service.SubjectLessonIssueImgService;
import com.mybatisflex.core.query.QueryWrapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 服务层实现。
 *
 * @author Administrator
 * @since 2024-03-07
 */
@Service
public class SubjectLessonIssueImgServiceImpl extends BaseServiceImpl<SubjectLessonIssueImgMapper, SubjectLessonIssueImg, SubjectLessonIssueImgTableDef> implements SubjectLessonIssueImgService {

    @Override
    protected SubjectLessonIssueImgTableDef getTable() {
        return SubjectLessonIssueImgTableDef.subjectLessonIssueImg;
    }

    @Override
    public List<SubjectLessonIssueImg> getImgList(String issueUid) {
        return getMapper().selectListByCondition(table.issueUid.eq(issueUid));
    }

    @Override
    public List<SubjectLessonIssueImg> getImgList(List<String> issueUids) {
        QueryWrapper wrapper = QueryWrapper.create()
                .select(table.issueUid, table.url)
                .where(table.issueUid.in(issueUids))
                .orderBy(table.issueUid.asc());

        return getMapper().selectListByQuery(wrapper);
    }
}
